package com.baibei.module.stock.theme;

import android.graphics.Color;

import com.baibei.widget.stock.theme.def.DefaultKLineTheme;
import com.github.mikephil.charting.charts.Chart;
import com.github.mikephil.charting.components.YAxis;
import com.github.mikephil.charting.renderer.CombinedChartRenderer;


/**
 * K线主题
 * Created by ChenRui on 2017/8/16 0016 11:44.
 */
public class KLineChartTheme extends DefaultKLineTheme {

    private int textColor = Color.parseColor("#B3303030");
    private int axisLineColor = Color.parseColor("#0D303030");

    private CombinedChartRenderer mRenderer;

    public KLineChartTheme() {

    }

    @Override
    public void loadTheme(Chart chart) {
        super.loadTheme(chart);
        this.mChart.getAxisLeft().setPosition(YAxis.YAxisLabelPosition.INSIDE_CHART);
        this.mChart.getAxisRight().setPosition(YAxis.YAxisLabelPosition.INSIDE_CHART);
        this.mChart.getXAxis().setEnabled(true);
        this.mChart.getXAxis().setLabelCount(4);
        this.mChart.getXAxis().setDrawLabels(true);
        this.mChart.getXAxis().setAxisLineColor(axisLineColor);
        this.mChart.getXAxis().setTextColor(textColor);
        this.mChart.getAxisLeft().setDrawAxisLine(true);
        this.mChart.getAxisLeft().setAxisLineColor(axisLineColor);
        this.mChart.setXAxisRenderer(new com.baibei.widget.stock.render.RaeXAxisRender(mChart.getViewPortHandler(), mChart.getXAxis(), mChart, mChart.getTransformer(YAxis.AxisDependency.LEFT)));
    }

    @Override
    protected void onLoadViewPortOffsets() {
    }
}
